package com.itheima.dao.impl;

import com.itheima.dao.AccountDao;
import com.itheima.domain.Account;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class AccountDaoImpl implements AccountDao {
    @Override
    public void save(Account account) {
        System.out.println("AccountDaoImpl save: " + account);
    }

    @Override
    public void update(Account account) {
        System.out.println("AccountDaoImpl update: " + account);
    }

    @Override
    public void delete(Integer id) {
        System.out.println("AccountDaoImpl delete: id=" + id);
    }

    @Override
    public Account findById(Integer id) {
        System.out.println("AccountDaoImpl findById: id=" + id);
        // 模拟返回
        Account account = new Account();
        account.setId(id);
        account.setName("test");
        account.setMoney(100.0);
        return account;
    }

    @Override
    public List<Account> findAll() {
        System.out.println("AccountDaoImpl findAll");
        // 模拟返回
        List<Account> list = new ArrayList<>();
        Account account = new Account();
        account.setId(1);
        account.setName("test");
        account.setMoney(100.0);
        list.add(account);
        return list;
    }
}
